package com.study;

import javax.swing.*;

public class GuessNumber {
    public static void main(String[] args) {
        JFrame jf = new JFrame();
        jf.setAlwaysOnTop(true);
        jf.setLocationRelativeTo(null);
        jf.setTitle("猜数字");
        jf.setDefaultCloseOperation(3);
        jf.setSize(400,300);
        jf.setLayout(null);

        // 提示信息
        JLabel message = new JLabel("系统产生了一个1-100之间的数据，请猜一猜");
        message.setBounds(70,50,350,20);
        jf.add(message);

        // 输入要猜的数字
        JTextField numberField = new JTextField();
        numberField.setBounds(120,100,150,20);
        jf.add(numberField);

        // 才数字的按钮
        JButton guessButton = new JButton("我猜");
        guessButton.setBounds(150,150,100,20);
        jf.add(guessButton);

        jf.setVisible(true);
    }
}
